home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / RAYTRACE.ZIP / LOADPCX.BAK < prev    next >
Encoding:
Text File  |  1994-06-11  |  1.5 KB  |  65 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                   256-color PCX loader header                          */
  3. /*                      Code by Dan Corritore                             */
  4. /*------------------------------------------------------------------------*/
  5. #ifndef _LOADPCX_H
  6.     #define _LOADPCX_H
  7.  
  8. /*    Header info extracted from USUAL.H: */
  9.  
  10. typedef int bool;
  11.  
  12. /*    Boolean values */
  13.  
  14. #define TRUE    1
  15. #define FALSE    0
  16.  
  17. /*    Assembly variable terms */
  18.  
  19. #define byte unsigned char
  20. #define word unsigned short
  21. #define dword unsigned long
  22.  
  23. /*-------- end 'USUAL.H'-------- */
  24.  
  25.  
  26. /*    VGA's palette structure    */
  27.  
  28. struct VgaPalette
  29. {
  30.     byte red,green,blue;
  31. };
  32.  
  33. /*    Simple structure to hold the decoded PCX image and data */
  34.  
  35. struct PcxPix
  36. {
  37.     word width,height;
  38.     byte *image;
  39. };
  40.  
  41. /*    load_pcx return values */
  42.  
  43. enum {
  44.     pcx_ok = 0,
  45.     pcx_invalid, /* not a valid 256-color PCX file */
  46.     pcx_nomem,   /* ran out of memory */
  47.     pcx_ferror,  /* file error occured */
  48.     pcx_openerr  /* file error on open */
  49. };
  50.  
  51. /*    256-color PCX load Function:
  52. **
  53. **    Decodes a PCX file, placing the info (and image) into 'pix'
  54. **    It places the PCX file's 256-color palette into 'pal'
  55. **
  56. **    NOTE: pix->image will be dynamically allocated (via farmalloc), and
  57. **    must be deleted (via farfree) by the caller
  58. */
  59.  
  60. extern int load_pcx(const char * name,
  61.                     struct PcxPix * pix,
  62.                     struct VgaPalette * pal);
  63.  
  64. #endif    /* _LOADPCX_H */
  65.